---@class Battle.BuffEffect7:Battle.BuffEffectBase
---创建英雄
local BuffEffect7 = Battle.CreateClass("BuffEffect7",Battle.BuffEffectBase)
Battle.BuffEffect7 = BuffEffect7
function BuffEffect7:OnCreate(buff)
    ---@type Battle.Buffer
    self.buff = buff
    local param = decodeJsonStrToTable(self.buff.cfg.f_EffectParameter)
    self.heroId = param[1][1]
    self.posType = param[1][2]
    self.radius = param[1][3]/1000
    self.actor = Battle.ActorManager.GetActor(self.buff.targetId)
end
function BuffEffect7:OnBuffStart()
    local p = Vector3.GetPool()
    local f = self.actor.forward
    if self.posType == 1 then --随机位置
        local x = math.random(-self.radius,self.radius)
        local z = math.random(-self.radius,self.radius)
        p.x = self.actor.pos.x + x
        p.z = self.actor.pos.z + z
    else
        if self.buff.sourceSkillId then--技能施法位置
            local skill = self.buff.sourceSender.skillSystem:GetSkill(self.buff.sourceSkillId)
            if skill == nil then
                logError("找不到来源技能 "..self.buff.sourceSkillId)
                return
            end
            p:SetV(skill.emitter:GetReleasePos())
        end
    end
    local hero = Battle.EntityFactory.CreateHero(self.heroId,self.actor.camp,p.x,p.y,p.z,f.x,f.y,f.z)
    hero.isSummon = true
    Vector3.ReturnPool(p)
end

return BuffEffect7